package fhp.hlhj.giantfold.adapter

import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import fhp.hlhj.giantfold.R
import fhp.hlhj.giantfold.utils.LogUtil
import kotlinx.android.synthetic.main.tabbao_item.view.*

/**
 * author: FHP
 * data: on 2017\11\27 0027 14:15
 * E-Mail: 103945089@qq.com
 */
class TaoBaoRcyAdp(layoutId:Int,data:List<String>) :BaseQuickAdapter<String,BaseViewHolder>(layoutId,data) {
    override fun convert(helper: BaseViewHolder, item: String?) {
        helper.setText(R.id.itemTitle,item)
        val view = helper.getView<TextView>(R.id.itemPrice)
        view.setOnClickListener {
            data.removeAt(helper.adapterPosition-1)
            LogUtil.log("数据为"+data.toString()+"位置为${helper.adapterPosition-1}")
            notifyItemRemoved(helper.adapterPosition)
        }
    }
}